<template>
  <el-switch
    :value="value"
    :active-value="1"
    :inactive-value="0"
    active-color="#13ce66"
    inactive-color="#ff4949"
    @change="handleChange"
  />
</template>

<script>
export default {
  name: 'ValiSwitch',
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    value: {
      type: [Boolean, Number, String], // 验证类型后续可以增加
      default: 0
    },
    formItem: {
      type: Object,
      default: () => ({})
    }
  },
  methods: {
    handleChange(v, item) {
      this.$emit('change', v)
      this.$emit('changeValied', this.formItem)
    }
  }
}
</script>

<style scoped lang="scss"></style>
